package com.sunnada.edu.system.pub.poi;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Map;

public class Test {
	
	public static void main(String[] args) throws Exception {
		
		Map<String, Object> param = new HashMap<String, Object>();
		//文本代替文本${name}
		param.put("${name}", "huangqiqing");  
 
		//图片代替文本${header}
		Map<String,Object> header = new HashMap<String, Object>();
		header.put("width", 160);
		header.put("height", 44);
		header.put("type", "png");
		header.put("content", WordUtil.inputStream2ByteArray(new FileInputStream("D:\\logo.png"), true));
		param.put("${header}",header);
		
		
		CustomXWPFDocument doc = WordUtil.generateWord(param, "D:\\1.docx");
		FileOutputStream fopts = new FileOutputStream("D:\\2.docx");
		doc.write(fopts);
		fopts.close();
	}
}
